package org.wu.framework.authorization.platform.application.assembler;

import org.wu.framework.authorization.platform.application.command.SysDictionaryCommand;
import org.wu.framework.authorization.platform.application.dto.SysDictionaryDTO;
import org.wu.framework.authorization.platform.domain.model.sys.dictionary.SysDictionary;
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyAssembler;

/**
 * describe
 *
 * @author Jia wei Wu
 * @date 2023/05/17 11:19 晚上
 * @see DefaultDDDLazyAssembler
 **/

public class SysDictionaryDTOAssembler {


    /**
     * describe 应用层入参转换成 持久层入参
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysDictionary toDictionary(SysDictionaryCommand sysDictionaryCommand) {
        if (null != sysDictionaryCommand) {
            SysDictionary sysDictionary = new SysDictionary();
            sysDictionary.setCode(sysDictionaryCommand.getCode());
            sysDictionary.setCreateTime(sysDictionaryCommand.getCreateTime());
            sysDictionary.setDescription(sysDictionaryCommand.getDescription());
            sysDictionary.setId(sysDictionaryCommand.getId());
            sysDictionary.setName(sysDictionaryCommand.getName());
            sysDictionary.setType(sysDictionaryCommand.getType());
            sysDictionary.setUpdateTime(sysDictionaryCommand.getUpdateTime());
            return sysDictionary;
        }
        return null;
    }

    /**
     * describe 持久层领域对象转换成DTO对象
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysDictionaryDTO fromDictionary(SysDictionary sysDictionary) {
        if (null != sysDictionary) {
            SysDictionaryDTO sysDictionaryDTO = new SysDictionaryDTO();
            sysDictionaryDTO.setCode(sysDictionary.getCode());
            sysDictionaryDTO.setCreateTime(sysDictionary.getCreateTime());
            sysDictionaryDTO.setDescription(sysDictionary.getDescription());
            sysDictionaryDTO.setId(sysDictionary.getId());
            sysDictionaryDTO.setName(sysDictionary.getName());
            sysDictionaryDTO.setType(sysDictionary.getType());
            sysDictionaryDTO.setUpdateTime(sysDictionary.getUpdateTime());
            return sysDictionaryDTO;
        }
        return null;
    }

}